<!--基本信息-->
<template>
  <Card>
    <Form :label-width="120" inline>
      <FormItem label="姓名：" prop="">
        <label>{{formData.customerName}}</label>
      </FormItem>
      <FormItem label="证件号码：" prop="">
        <label>{{formData.idCardNo}}</label>
      </FormItem>
      <FormItem label="手机号码：" prop="">
        <label>{{formData.phoneNo}}</label>
      </FormItem>
      <FormItem label="登录名：" prop="">
        <label>{{formData.loginName}}</label>
      </FormItem>
      <FormItem label="注册时间：" prop="">
        <label>{{formData.registTime}}</label>
      </FormItem>
      <br>
      <Content style="margin-top:20px;">
        <Table :columns="columns1" :data="bankCardData"></Table>
      </Content>
      <!-- <div>
        <Page :total="totalPage" :current="currentPage" :page-size="pageSize" show-elevator show-total @on-change="handlePageChange"></Page>
      </div> -->
    </Form>
  </Card>
</template>
<script>
export default {
  name: 'basic-info-form',
  data () {
    return {
      bankCardData: [],
      formData: {
        customerName: '',
        idCardNo: '',
        phoneNo: '',
        loginName: '',
        registTime: ''
      },
      $ajax: null,
      columns1: [
        {
          title: '序号',
          type: 'index',
          width: 60
        },
        {
          title: '银行卡号',
          key: 'bankCardNo',
          align: 'center'
        },
        {
          title: '绑定银行卡名称',
          key: 'bankCardName',
          align: 'center'
        },
        {
          title: '绑定银行卡时间',
          key: 'bankCardDate',
          align: 'center',
          render: (h, params) => {
            var vm = this
            return h('span', {}, vm.$util.formatTime(params.row.bankCardDate))
          }
        }
      ],
      // currentPage: 1,
      // pageSize: 20,
      // totalPage: 0,
      baseUrl: this.$appContext.marvels_core_loanapply
    }
  },
  methods: {
    // handlePageChange (goPage) {
    //   this.initPage(goPage)
    // },
    initPage (goPage) {
      if (parseFloat(goPage).toString() === 'NaN') {
        goPage = 1
      }
      var vm = this
      var url = vm.baseUrl + 'loanApply/customerservice/query/service/findBankCardPageList'
      var param = {
        loanId: vm.$route.query.id,
        idCardNo: vm.$route.query.custIdCard,
        pageNo: goPage
      }
      vm.$ajax.post(url, param).then(re => {
        var data = re.data
        var code = data.code
        var message = data.message
        if (code !== 'success') {
          this.$Message.warning(message)
          return
        }
        var datas = data.data || []
        datas.forEach(item => {
          var tData = {}
          tData.customerName = item.customerName
          tData.idCardNo = item.idCardNo
          tData.phoneNo = item.phoneNo
          tData.loginName = item.loginName
          tData.hangTime = this.$util.formatTime(new Date(item.registTime))
          tData.bankCardNo = item.bankCardNo
          tData.bankCardName = item.bankCardName
          tData.bankCardDate = this.$util.formatTime(new Date(item.bankCardDate))
          vm.bankCardData.push(tData)
        })
        vm.formData = vm.bankCardData[0] || {}
        vm.totalPage = re.data.data.total
        vm.pageSize = re.data.data.pageSize
        vm.currentPage = re.data.pageNum
      }).catch(er => {

      })
    }
  },
  created () {
    this.$ajax = this.$util.ajax()
    this.initPage(1)
    // this.bankCardData=[{'bankCardNo':'111111','bankCardName':'中国银行','bankCardTime':'2018-08-08'}];
  }
}
</script>
